package com.k2data.k2app.rest;

import com.k2data.k2app.rest.domain.DictRest;
import com.k2data.k2app.rest.domain.RectList;
import com.k2data.k2app.rest.domain.RegionRest;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author lidong9144@163.com 17-6-15.
 */
@Component
@FeignClient(value = "K2ALPHA-SYS-V1", fallback = SysClientFallback.class)
public interface SysClient {

    @RequestMapping(method = RequestMethod.GET, value = "/dicts")
    DictRest get(@RequestParam(value = "type") String type);

    @RequestMapping(method = RequestMethod.GET, value = "/users/{id}/roles")
    RectList getRolesByUser(@PathVariable("id") Long id);

    @RequestMapping(method = RequestMethod.GET, value = "/regions")
    RegionRest getRegion(@RequestParam(value = "code") String code,
                         @RequestParam(value = "province") String province,
                         @RequestParam(value = "city") String city,
                         @RequestParam(value = "district") String district);

}
